const REQUEST = 'REQUEST'
const SUCCESS = 'SUCCESS'
const FAILURE = 'FAILURE'

// 生成action的type
export const CreateRequestTypes = (base) => {
  const res = {}
  const types = [REQUEST, SUCCESS, FAILURE]
  types.forEach((type) => {
    res[type] = Symbol(`${base}_${type}`)
  })
  return res
}

// 创建action
export const CreateAction = (actionType) => (data) => ({
  type: actionType,
  payload: data
})
